package com.jochen.core.tools

import com.badlogic.gdx.math.Polygon
import com.jochen.core.components.Transform

fun Polygon.updatePolygon(transform: Transform){
    val size = transform.size * transform.scaling
    val half = size * 0.5f
    val localVertices = floatArrayOf(
    -half.x, -half.y,  half.x,  -half.y,   
    half.x,  half.y,   -half.x, half.y  )
    vertices = localVertices 
    setOrigin(0f, 0f)
    rotation = transform.rotationDeg 
    val pos = transform.position + half
    setPosition(pos.x,pos.y)
}